ccR.Add_Rotation(
	3, -- Player Specialization
	"CC_Destruction_Solo", -- Function name
	"Developed early WoD, Not recommended.", -- Description
	"CC_Destruction_Talents", -- Talents button frame
	"CC_Destruction_Abilities", -- Abilities button frame
	"CC_Destruction_Features", -- Features button frame
	"CC_Destruction_Setup" -- Setup button frame
)

function CC_Destruction_Solo()
	-- Dark Intent
	if not ccR.Player.Has.Buff(DARK_INTENT)
	and not IsMounted()
	and not ccR.Player.Has.Buff(ARCANE_BRILLIANCE)
	and not ccR.Player.Has.Buff(DALARAN_BRILLIANCE)
	and not ccR.Player.Has.Buff(STILL_WATER)
	and ccR.Spell.Is.Ready(DARK_INTENT)
	then
		ccR.Cast.Spell(DARK_INTENT) 
	end
	if ccR.Player.Is.InCombat() then
		ccR_Warlock_Imp_Flee()
		ccR_Warlock_Cauterize_Master()
		if ccR.Player.IsMoving() and ccR.Target.Exists() and ccR.Player.HasTalent(KILJAEDENS_CUNNING) and ccR.Spell.IsReady(KILJAEDENS_CUNNING) then ccR.Cast.Spell(KILJAEDENS_CUNNING) end
		-- Dark Soul Instability
		if ccR.Spell.Is.Ready(DARK_SOUL_INSTABILITY) then ccR.Cast.Spell(DARK_SOUL_INSTABILITY) end
		-- Shadowburn ANY on 20% or less
		for x = 1, # ccR_Enemies_In_Combat do
			local vUnit = ccR_Enemies_In_Combat[x]
			if ccR.Spell.Is.Ready(SHADOWBURN, true)
			and	ccR.Player.Burning_Embers() >= 10
			and ccR.Unit.Is.Attackable(vUnit)
			and (ccR.Unit.Health(vUnit) > 0 and ccR.Unit.Health(vUnit) <= 20)
			and ccR.Unit.Distance(vUnit, "player") <= 40
			and ccR.Player.Is.Facing(vUnit)
			and ccR.Unit.Is.InLineOfSight(vUnit, "player")
			then
				if ccR.Player.Is.CastingOrChanneling() then SpellStopCasting() end
				ccR.Cast.Attack(SHADOWBURN, vUnit)
				return
			end
		end
		-- Havoc
		for x = 1, # ccR_Enemies_In_Combat do
			local vUnit = ccR_Enemies_In_Combat[x]
			if ccR.Spell.Is.Ready(HAVOC, true)
			and ccR.Unit.Is.Attackable(vUnit)
			and ccR.Spell.CanAttack(HAVOC, vUnit)
			and ccR.Target.GUID() ~= ccR.Unit.GUID(vUnit)
			and ccR.Unit.Is.InLineOfSight(vUnit, "player")
			then
				if ccR.Player.Is.CastingOrChanneling() then SpellStopCasting() end
				ccR.Cast.Attack(HAVOC, vUnit)
				return
			end
		end
	end
	if ccR.Target.Is.Attackable() then
		local vCount = ccR.Target.Count(12)
		if (vCount >= 1 and vCount <= 3) then
			if ccR.Player.HasBuff(FIRE_AND_BRIMSTONE) then ccR.RemoveBuff(FIRE_AND_BRIMSTONE) end
			ccR.Cast.Mass.Debuff(IMMOLATE, 3, 40, true, 3)
		end
		if vCount >= 4 then
			if ccR.Player.Has.Buff(FIRE_AND_BRIMSTONE) and ccR.Player.Burning_Embers() <= 9 then ccR.RemoveBuff(FIRE_AND_BRIMSTONE)
			elseif ccR.Spell.Is.Ready(FIRE_AND_BRIMSTONE) and ccR.Player.Burning_Embers() >= 10 and not ccR.Player.Has.Buff(FIRE_AND_BRIMSTONE) then ccR.Cast.Spell(FIRE_AND_BRIMSTONE)
			elseif ccR.Spell.Is.Ready(RAIN_OF_FIRE) and not ccR.Target.Has.MyDebuff(RAIN_OF_FIRE) then ccR.Cast.AoE(RAIN_OF_FIRE, "target", 35, 12)
			elseif ccR.Spell.CanAttack(FAB_IMMOLATE) and (not ccR.Target.Has.MyDebuff(FAB_IMMOLATE) or ccR.Target.DebuffDuration(FAB_IMMOLATE) <= 5) and (not ccR.Player.IsMoving() or ccR.Player.HasBuff(KILJAEDENS_CUNNING)) then ccR.Cast.Attack(FAB_IMMOLATE)
			elseif ccR.Spell.CanAttack(CONFLAGRATE) then ccR.Cast.Attack(CONFLAGRATE)
			elseif ccR.Spell.CanAttack(INCINERATE) and (not ccR.Player.IsMoving() or ccR.Player.HasBuff(KILJAEDENS_CUNNING)) then ccR.Cast.Attack(INCINERATE) 
			end
		return
		end			
		if ccR.Target.Is.Attackable() then
			if ccR.Player.Is.Facing("target") then
				if ccR.Spell.CanAttack(SHADOWBURN) and ccR.Target.Health() <= 20 then ccR.Cast.Attack(SHADOWBURN)
				elseif ccR.Spell.CanAttack(IMMOLATE) and (not ccR.Player.Is.Moving() or ccR.Player.Has.Buff(KILJAEDENS_CUNNING)) and not ccR.Target.Has.MyDebuff(IMMOLATE) then ccR.Cast.Debuff(IMMOLATE) 
				elseif ccR.Spell.CanAttack(CONFLAGRATE) and ccR.Spell.Charges(CONFLAGRATE) == 2 then ccR.Cast.Attack(CONFLAGRATE)
				elseif ccR.Spell.CanAttack(CHAOS_BOLT) and (not ccR.Player.Is.Moving() or ccR.Player.Has.Buff(KILJAEDENS_CUNNING)) and (ccR.Player.Burning_Embers() >= 35 or ccR.Player.HasBuff(DARK_SOUL_INSTABILITY)) then ccR.Cast.Attack(CHAOS_BOLT)
				elseif ccR.Spell.CanAttack(IMMOLATE) and (not ccR.Player.Is.Moving() or ccR.Player.Has.Buff(KILJAEDENS_CUNNING)) and ccR.Target.DebuffDuration(IMMOLATE) <= 4.5 then ccR.Cast.Debuff(IMMOLATE)
				end
			end
			if ccR.Spell.Is.Ready(RAIN_OF_FIRE) and not ccR.Target.Has.MyDebuff(RAIN_OF_FIRE) then ccR.Cast.AoE(RAIN_OF_FIRE, "target", 35, 12) end
			if ccR.Player.Is.Facing("target") then
				if ccR.Spell.CanAttack(CONFLAGRATE) and ccR.Spell.Charges(CONFLAGRATE) == 1 then ccR.Cast.Attack(CONFLAGRATE)
				elseif ccR.Spell.CanAttack(INCINERATE) and (not ccR.Player.IsMoving() or ccR.Player.HasBuff(KILJAEDENS_CUNNING)) then ccR.Cast.Attack(INCINERATE)
				end
			end
		end
	end
end